import { useEffect, useState } from "react"
import { onGloblState } from "../utils/globalState"
 const useGlobalState = ({event}:{ event: string }) => {
    const [data, setData] = useState(null)
    useEffect(() => {
        return onGloblState(event,(d)=>{
            
             setData(d)
        })
    }, [])
    return { data }
}
export default useGlobalState